1 /*
2 * _coder_matlabfindpeaks_mex.c
3 *
4 * Code generation for function '_coder_matlabfindpeaks_mex'
5 *
6 */
7
8 /* Include files */
9 #include "matlabfindpeaks.h"
10 #include "_coder_matlabfindpeaks_mex.h"
11
12 /* Variable Definitions */
13 static matlabfindpeaksStackData *matlabfindpeaksStackDataGlobal = NULL;
14
15 /* Function Declarations */
16 static void matlabfindpeaks_mexFunction(matlabfindpeaksStackData *SD, int32_T
17 nlhs, mxArray *plhs[2], int32_T nrhs, const mxArray *prhs[3]);
18
19 /* Function Definitions */
20 static void matlabfindpeaks_mexFunction(matlabfindpeaksStackData *SD, int32_T
21 nlhs, mxArray *plhs[2], int32_T nrhs, const mxArray *prhs[3])
22 {
23 int32_T n;
24 const mxArray *inputs[3];
25 const mxArray *outputs[2];
26 int32_T b_nlhs;
27 emlrtStack st = { NULL, NULL, NULL };
28
29 st.tls = emlrtRootTLSGlobal;
30
31 /* Check for proper number of arguments. */
32 if (nrhs != 3) {
33 emlrtErrMsgIdAndTxt(&st, "EMLRT:runTime:WrongNumberOfInputs", 5, 12, 3, 4,
34 15, "matlabfindpeaks");
35 }
36
37 if (nlhs > 2) {
38 emlrtErrMsgIdAndTxt(&st, "EMLRT:runTime:TooManyOutputArguments", 3, 4, 15,
39 "matlabfindpeaks");
40 }
41
42 /* Temporary copy for mex inputs. */
43 for (n = 0; n < nrhs; n++) {
44 inputs[n] = prhs[n];
45 if (*emlrtBreakCheckR2012bFlagVar != 0) {
46 emlrtBreakCheckR2012b(&st);
47 }
48 }
49
50 /* Call the function. */
51 matlabfindpeaks_api(SD, inputs, outputs);
52
53 /* Copy over outputs to the caller. */
54 if (nlhs < 1) {
55 b_nlhs = 1;
56 } else {
57 b_nlhs = nlhs;
58 }
59
60 emlrtReturnArrays(b_nlhs, plhs, outputs);
61
62 /* Module termination. */
63 matlabfindpeaks_terminate();
64 }
65
66 void mexFunction(int32_T nlhs, mxArray *plhs[], int32_T nrhs, const mxArray
67 *prhs[])
68 {
69 matlabfindpeaksStackDataGlobal = (matlabfindpeaksStackData *)mxCalloc(1, 1U *
70 sizeof(matlabfindpeaksStackData));
71 mexAtExit(matlabfindpeaks_atexit);
72
73 /* Initialize the memory manager. */
74 /* Module initialization. */
75 matlabfindpeaks_initialize();
76
77 /* Dispatch the entry-point. */
78 matlabfindpeaks_mexFunction(matlabfindpeaksStackDataGlobal, nlhs, plhs, nrhs,
79 prhs);
80 mxFree(matlabfindpeaksStackDataGlobal);
81 }
82
83 emlrtCTX mexFunctionCreateRootTLS(void)
84 {
85 emlrtCreateRootTLS(&emlrtRootTLSGlobal, &emlrtContextGlobal, NULL, 1);
86 return emlrtRootTLSGlobal;
87 }
88
89 /* End of code generation (_coder_matlabfindpeaks_mex.c) */
90
|